<template>
  <div class="box">
    <h2>1子组件</h2>
    值：<label>{{count}}</label>
    <br>
    <button @click="countAdd(1)">值 +1</button>
    <button @click="countAdd(5)">值 +5</button>
    <button @click="changeTiele">更改标题</button>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  methods: {
    countAdd (n) {
      this.$store.commit('addCount', n)
    },
    changeTiele () {
      this.$store.commit('cTietl', {
        oldName: 'smalltitle',
        msg: 'aaa'
      })
    }
    /*     countAddd () {
      this.$store.commit('addCountt')
    } */
  },
  computed: {
    ...mapState(['count'])
  }

}
</script>

<style>
  .box{
    border: 3px solid #ccc;
    width: 400px;
    padding: 10px;
    margin: 20px;
  }
  h2{
    margin-top: 10px;
  }
</style>
